.TH std::future::share 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::future::share \- std::future::share

.SH Synopsis
   std::shared_future<T> share() noexcept;

   Transfers the shared state of *this, if any, to a std::shared_future object.
   Multiple std::shared_future objects may reference the same shared state, which is
   not possible with std::future.

   After calling share on a std::future, valid() == false.

.SH Parameters

   \fI(none)\fP

.SH Return value

   A std::shared_future object containing the shared state previously held by *this, if
   any, constructed as if by std::shared_future<T>(std::move(*this)).

.SH Example

    This section is incomplete
    Reason: no example

   Defect reports

   The following behavior-changing defect reports were applied retroactively to
   previously published C++ standards.

      DR    Applied to     Behavior as published              Correct behavior
   LWG 2556 C++11      share() requires valid() to be requirement removed and made
                       true                           noexcept

.SH See also

   shared_future waits for a value (possibly referenced by other futures) that is set
   \fI(C++11)\fP       asynchronously
                 \fI(class template)\fP

.SH Category:
     * Todo no example
